module Fixpoint where

import Cpo

-- Only defined for continuous functions f.

condFixpoint :: Cpo a => (a -> a) -> a -> a
condFixpoint f w = let next = f w
                   in if next == w then w else condFixpoint f next

fixpoint :: Cpo a => (a -> a) -> a
fixpoint f = condFixpoint f bottom
